/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ResultEditor.AnnotationClasses;

import java.awt.Color;
import javax.swing.tree.DefaultMutableTreeNode;

/**
 *
 * @author leng
 */
 /**tree view node for annotated class*/
public class Treeview_ClassNode extends DefaultMutableTreeNode {
    String text;
    boolean selected;
    Color c;
    int amountofAnnotations, amountofAnnotationTypes;
    boolean isSelected_toCreateAnnotation = false;

    public Treeview_ClassNode(String text, boolean selected, Color c,
            int amountofAnnotations, int amountofAnnotationTypes) {
        super();
        this.text = text;
        this.selected = selected;
        this.c = c;
        this.amountofAnnotations =  amountofAnnotations;
        this.amountofAnnotationTypes = amountofAnnotationTypes;
    }

    public Color getClassColor(){
        return c;
    }

    public void setFlag_isSelected_toCreateAnnotation( boolean flag ){
        isSelected_toCreateAnnotation = flag;
    }

    public boolean isSelected_toCreateAnnotation(){
        return isSelected_toCreateAnnotation;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean newValue) {
        selected = newValue;
    }

    public String getDisplayText(){
        if ( this.text.contains("<html>"))
            return this.text;

        if ( this.amountofAnnotationTypes > 0 ){
            String displaytext = this.text;
            displaytext = "<html>" + displaytext;
            displaytext = displaytext + " [<b><font color=blue>"
                + this.amountofAnnotationTypes
                + "/"
                + this.amountofAnnotations
                + "</b></font>]</html>";
            return displaytext;
        }else{
            return this.text;
        }
    }

    public String getText() {
        return this.text;
    }

    public int getAnnotationAmount(){
        return this.amountofAnnotations;
    }

    public int getAnnotationTypeAmount(){
        return this.amountofAnnotationTypes;
    }

    @Override
    public String toString() {
        return this.text;
    }

    public void setText(String newValue) {
        this.text = newValue;
    }
}
